import {createBrowserRouter} from 'react-router-dom'
import { lazy } from 'react'

import Layout from '../pages/layout/Index'
import Login from '../pages/Login/Index'
import Error from '../pages/404/Index'
import Msg from '../pages/msg/Index'

let Home=lazy(()=>import('../pages/home/Index'))

export let childroutes=[
    {
        path:'/',
        element:<Home></Home>,
        title:'首页'
    }
]

let routes=createBrowserRouter([
    {
        path:'/',
        element:<Layout></Layout>,
        children:childroutes
    },
    {
        path:'/login',
        element:<Login></Login>
    },
    {
        path:'/msg',
        element:<Msg></Msg>
    },
    {
        path:'*',
        element:<Error></Error>
    }
])

export default routes
